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