UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '80+lZbNN0ua21x2NCEMaMuATuKbNH0dOlJi15dCqi1Q=' 
WHERE 
  key_id = '341a22fadf5e818ad77bc28789b77d7fa2c4c430606d4bcc8c3964ffbd0a2ac5' 
  AND (
    token = '80+lZbNN0ua21x2NCEMaMuATuKbNH0dOlJi15dCqi1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038