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