UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3KjEdxzMXH8/lC4SZycAVmvHjVmWLdRRwL3kDyA8mY8='
WHERE
key_id = '1a3684f2aab6e8e96b127b1af12a8166bbf1a4e403482984e5ba7f5258f3173e'
AND (
token = '3KjEdxzMXH8/lC4SZycAVmvHjVmWLdRRwL3kDyA8mY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)