UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gVy2r9xFsgf3FywtktHjPMX3mqd+hszi/2pkoO+fzKY='
WHERE
key_id = 'a60a4f51300023c85c06148bc751171834146082a1ee7ed5b8db941b97a91380'
AND (
token = 'gVy2r9xFsgf3FywtktHjPMX3mqd+hszi/2pkoO+fzKY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)