UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f+zef5HR6BoUSFHjHRwGwfGSoTpFOUvOnEC2/lGYm0g=' 
WHERE 
  key_id = 'a8779c1fedf10d86a61afbade8ef2b82c060fb4339867b42266e6d20f98ef0d1' 
  AND (
    token = 'f+zef5HR6BoUSFHjHRwGwfGSoTpFOUvOnEC2/lGYm0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030