UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WScKHX7DzGerurV0FakSEzEn9DdecfERTcL3wjQ6WoQ=' 
WHERE 
  key_id = 'c8e8a77cd9a072d0f498cd32d848bcf48f43da23e3928c04910155a01379f905' 
  AND (
    token = 'WScKHX7DzGerurV0FakSEzEn9DdecfERTcL3wjQ6WoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033