UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wHU2IZHrXxVzQ+cIUXqCMnfAPyBM9I2uWFojAIf9IHw=' 
WHERE 
  key_id = '219f880a67b4c0b6f04ad154a856ee2f2803337c2bade83a85dd388f17912d1a' 
  AND (
    token = 'wHU2IZHrXxVzQ+cIUXqCMnfAPyBM9I2uWFojAIf9IHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034