UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c481xYaU5rb/flvCJUkNDAEDv30UBmIqeZcUeCoe1rs='
WHERE
key_id = 'a64a8204424ea8f3b3a6f8d2cb1ed03b1514ec4f5e331270fa52f95849f749d7'
AND (
token = 'c481xYaU5rb/flvCJUkNDAEDv30UBmIqeZcUeCoe1rs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)