UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QVAqhLKG4wVKD3A9FaIoqyn0aTUg6yEGKfWDnc+IKdM=' 
WHERE 
  key_id = 'cc6d1157eeebddb34f6e490edbc229bfc540a5b0eedb33a9bef5cc611167040f' 
  AND (
    token = 'QVAqhLKG4wVKD3A9FaIoqyn0aTUg6yEGKfWDnc+IKdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022