UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ww4z+qc+3Vr+w0koDw3g25V2HhljuvSYS5G5YVTalbk='
WHERE
key_id = 'ff479eab61ed8667f9f6deee44b591eec3117628ddc3f99fe1266f1a67a34a37'
AND (
token = 'Ww4z+qc+3Vr+w0koDw3g25V2HhljuvSYS5G5YVTalbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)