UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bDQhnax+NWD7mT6pO2vaAK456YAVr/kKd908YhUHA0A=' 
WHERE 
  key_id = '9c7d2b4826025f4b8216516a8f5b26c1a5e30981d7a655defeda0d1e25538249' 
  AND (
    token = 'bDQhnax+NWD7mT6pO2vaAK456YAVr/kKd908YhUHA0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029