UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f9NpaUcZZ2eIzPXwIAuq5ETAsKRnjNQSjwvR5862bv4=' 
WHERE 
  key_id = '5dc7d49289e7835e49e70062c462c7167735f6346c9483a686378c2fd499bb88' 
  AND (
    token = 'f9NpaUcZZ2eIzPXwIAuq5ETAsKRnjNQSjwvR5862bv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021