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

Query time 0.00029