UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mia8pUYXnH6lAR01Y0gCvRAb3OvYTrlfEr9LLdKUJhs=' 
WHERE 
  key_id = '676450030873436702c606b21a8a174aa4674a9dcaeda71dd97d74c8df8c2f3c' 
  AND (
    token = 'Mia8pUYXnH6lAR01Y0gCvRAb3OvYTrlfEr9LLdKUJhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029