UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'idU+t5FMlbncbKxjrfWBe3rm7ehe/jOTzXE3SF4ZJ7Q='
WHERE
key_id = 'fd5e09617f4117f82b4f298ce2d210c5cc9ec534f6a8d7a8fc7397e6ff55d0ec'
AND (
token = 'idU+t5FMlbncbKxjrfWBe3rm7ehe/jOTzXE3SF4ZJ7Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)