UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2jY9gV5CaIJdTzEgNZ8Qw0ZGIgaR7obb70y9AF2Khng='
WHERE
key_id = '8f81dfca6c61a29af1c6c98e17c9b1c6791e831b819019bd8fbfad0df630f8dd'
AND (
token = '2jY9gV5CaIJdTzEgNZ8Qw0ZGIgaR7obb70y9AF2Khng='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)