UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sCFERlxokjVpzhqNhhZmeMxiuokgd7lwDLrcVuilw08='
WHERE
key_id = 'd0eedccc2c7891faff4140b96499a18798fb2fd3a645ea6dc28c934f5b6f63f1'
AND (
token = 'sCFERlxokjVpzhqNhhZmeMxiuokgd7lwDLrcVuilw08='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)