UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gMYz/DsEE8O36FGa7Hh3eWg5FSVqJcjhospDX4F5hOc='
WHERE
key_id = '604b3f9f3de8b375c5854105834d8d26e01354408ff52023f913146c1e5a46ae'
AND (
token = 'gMYz/DsEE8O36FGa7Hh3eWg5FSVqJcjhospDX4F5hOc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)