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

Query time 0.00041