UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PJa0+K/kAlK360R0WdBQcw6eGAIjo+lEheQW39oREHw=' 
WHERE 
  key_id = '77bd0510637a580058f5c7043289b17c2fbf7e9cc7788b46230afa1d419dc3c8' 
  AND (
    token = 'PJa0+K/kAlK360R0WdBQcw6eGAIjo+lEheQW39oREHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021