UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WYcXbZgF43ZnBo4xQcgacGGiK6yQ/tC+uISnZHNAlD8=' 
WHERE 
  key_id = 'f29b1b6687509c956cd634e94bcfbeaf79ac3401310112a6b1b64bf539bfce50' 
  AND (
    token = 'WYcXbZgF43ZnBo4xQcgacGGiK6yQ/tC+uISnZHNAlD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042