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