UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lDmJCUmYPd+brTtv284XH94Z0rsnERmA657uffCSTXc='
WHERE
key_id = '27e9cf2d91a4c7c60e2b27db766f99616b1ccc1ae2aae989269dacc4dfb44656'
AND (
token = 'lDmJCUmYPd+brTtv284XH94Z0rsnERmA657uffCSTXc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)