UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oEW30JXEVADtq9cElGJxwnyCuJ9IiPmXXuhqsleIZNo='
WHERE
key_id = 'e3d7884c3e22dd3ac4326f000347df21b22f16222a10f832cc2633cf2373fff4'
AND (
token = 'oEW30JXEVADtq9cElGJxwnyCuJ9IiPmXXuhqsleIZNo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)