UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n2gWkD6bdEJ8lWh9m9YDeEnhYNfEhzDLC6brkZ3gD1c=' 
WHERE 
  key_id = '66aa0cd57bc1e643c822fa5a8afdd11664b3fd86e72c89a0e4aa447cbf64e286' 
  AND (
    token = 'n2gWkD6bdEJ8lWh9m9YDeEnhYNfEhzDLC6brkZ3gD1c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038