UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uj0UDcGeeja6nBuj/0GPRgLopnjOPESEXLHa3bBHoz8='
WHERE
key_id = '9e840bbf5446099ff7a2ffa884f9efb816926c3d896d1e8eaa9c0240a7e56b2d'
AND (
token = 'uj0UDcGeeja6nBuj/0GPRgLopnjOPESEXLHa3bBHoz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)