UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K/tQ4ipQFFBWChf4f8GhQ9+cruTK5txkRLQ+Df0CaD4=' 
WHERE 
  key_id = '863df663ce6a81b98c0e2dc43282b24f37bb90f54c381172389914b5c107e47b' 
  AND (
    token = 'K/tQ4ipQFFBWChf4f8GhQ9+cruTK5txkRLQ+Df0CaD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038