UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ihnFPqazGa/cOV1yTw0HZnbFyVDWVHpz8/2dW3WY4eI=' 
WHERE 
  key_id = 'f12848086e8c0b0c84ea73d94aede53bec437931add4aa0e5c3a1042a012d334' 
  AND (
    token = 'ihnFPqazGa/cOV1yTw0HZnbFyVDWVHpz8/2dW3WY4eI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024