UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X3C8h1IFL6ZAFwJvTA3N3RArjMCWg3uSVjoJ1JeZ47k='
WHERE
key_id = '2e818b0b371461a1cdc5e1b283e54d421f34a106825629d60f18298d3f5a1591'
AND (
token = 'X3C8h1IFL6ZAFwJvTA3N3RArjMCWg3uSVjoJ1JeZ47k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)