UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ihYGc9gP20VK/BqkEMf7qLKI1LiEh75BZfZmY5oE2dQ='
WHERE
key_id = 'f7d90ea2a79eede7852fc902a330d39d9beac95f9749050cd161db1e6c4faddc'
AND (
token = 'ihYGc9gP20VK/BqkEMf7qLKI1LiEh75BZfZmY5oE2dQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)