UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wjliEwxnw0JTjevkx9HIjsPRocPaKNEIYWrWQiwG8ik=' 
WHERE 
  key_id = '1d93519726e445307b499033f0e1d7e24a35da0569a293ea70467851545ab6a2' 
  AND (
    token = 'wjliEwxnw0JTjevkx9HIjsPRocPaKNEIYWrWQiwG8ik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032