UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'suO4+xGZE8Ua1JIM07pOPUpW47MvyNqGMRFE7qldO24='
WHERE
key_id = '7399c00384fa7c0fe91428d86e7e31a0b8fdc74e875891d4bae9e27a87579ff9'
AND (
token = 'suO4+xGZE8Ua1JIM07pOPUpW47MvyNqGMRFE7qldO24='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)