UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I1rLJbcrByiwtJ5k7AJbTuBqLZpWLcXMEPO6wph4uls='
WHERE
key_id = '4774a020203598671e805c7044358c9283c41ee76bf210f5e4e78b5050c6ca7d'
AND (
token = 'I1rLJbcrByiwtJ5k7AJbTuBqLZpWLcXMEPO6wph4uls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)