UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J2a1v/Jbik0XbYrEWS4VgWoB+IOfDuIzUm2dsL+bzRk=' 
WHERE 
  key_id = '6aad43e620edd6d05691f2f847231c568610203032a7649c4fcb7dc9f5670410' 
  AND (
    token = 'J2a1v/Jbik0XbYrEWS4VgWoB+IOfDuIzUm2dsL+bzRk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038