UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rSwEb8GuXH96kgyWE408+KOceoA9ApOa0MkuMZTqP58=' 
WHERE 
  key_id = 'a36a3c506fb9de976f59fdeeb4a1bf775dff07b00132227cb94be5000cabfd2f' 
  AND (
    token = 'rSwEb8GuXH96kgyWE408+KOceoA9ApOa0MkuMZTqP58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023